package com.cloud.adrian.novel.common.constant;

import lombok.Getter;

/**
 * 数据库常量
 * @Author: xiangguiliang
 * @version: 1.0
 * @since: 2024/05/16
 */
public class DatabaseConstants {
    /**
     * 用户信息表
     */
    public static class UserInfoTable {
        private UserInfoTable () {
            throw new IllegalStateException(SystemConfigConstants.CONSTANT_INSTANCE_EXCEPTION_MSG);
        }
        public static final String COLUMN_USERNAME = "username";
    }

    /**
     * 小说表
     */
    public static class BookTable {
        private BookTable () {
            throw new IllegalStateException(SystemConfigConstants.CONSTANT_INSTANCE_EXCEPTION_MSG);
        }

        public static final String COLUMN_CATEGORY_ID = "category_id";
        public static final String COLUMN_BOOK_NAME = "book_name";
        public static final String AUTHOR_ID = "author_id";
        public static final String COLUMN_VISIT_COUNT = "visit_count";
        public static final String COLUMN_WORD_COUNT = "word_count";
        public static final String COLUMN_LAST_CHAPTER_UPDATE_TIME = "last_chapter_update_time";
    }

    /**
     * 小说章节表
     */
    public static class BookChapterTable {
        private BookChapterTable () {
            throw new IllegalStateException(SystemConfigConstants.CONSTANT_INSTANCE_EXCEPTION_MSG);
        }
        public static final String COLUMN_BOOK_ID = "book_id";
        public static final String COLUMN_CHAPTER_NUM = "chapter_num";
        public static final String COLUMN_LAST_CHAPTER_UPDATE_TIME = "last_chapter_update_time";
    }

    /**
     * 小说内容表
     */
    public static class BookContentTable {
        private BookContentTable () {
            throw new IllegalStateException(SystemConfigConstants.CONSTANT_INSTANCE_EXCEPTION_MSG);
        }
        public static final String COLUMN_CHAPTER_ID = "chapter_id";
    }

    /**
     * 小说类别表
     */
    public static class BookCategoryTable {
        private BookCategoryTable () {
            throw new IllegalStateException(SystemConfigConstants.CONSTANT_INSTANCE_EXCEPTION_MSG);
        }
        public static final String COLUMN_WORK_DIRECTION = "work_direction";
    }

    /**
     * 小说评论表
     */
    public static class BookCommentTable {
        private BookCommentTable () {
            throw new IllegalStateException(SystemConfigConstants.CONSTANT_INSTANCE_EXCEPTION_MSG);
        }

        public static final String COLUMN_BOOK_ID = "book_id";

        public static final String COLUMN_USER_ID = "user_id";
    }

    /**
     * 作家信息表
     */
    public static class AuthorInfoTable {
        private AuthorInfoTable () {
            throw new IllegalStateException(SystemConfigConstants.CONSTANT_INSTANCE_EXCEPTION_MSG);
        }
        public static final String COLUMN_USER_ID = "user_id";
    }

    /**
     * 通用列枚举类
     */
    @Getter
    public enum CommonColumnEnum {
        /**
         * 表id
         */
        ID("id"),

        /**
         * 排序
         */
        SORT("sort"),

        /**
         * 创建时间
         */
        CREATE_TIME("create_time"),

        /**
         * 更新时间
         */
        UPDATE_TIME("update_time");

        private String name;

        CommonColumnEnum(String name) {
            this.name = name;
        }
    }

    /**
     * sql语句枚举类
     */
    @Getter
    public enum SqlEnum {
        /**
         * 返回结果限制为1
         */
        LIMIT_1("limit 1"),
        LIMIT_2("limit 2"),
        LIMIT_5("limit 5"),
        LIMIT_30("limit 30"),
        LIMIT_500("limit 500");

        private String sql;

        SqlEnum(String sql) {
            this.sql = sql;
        }
    }
}
